package com.flavors.ifly.hencoderplus;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.Nullable;

public class DrawableView extends View {

    private Drawable colorDrawable;

    public DrawableView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    {
        colorDrawable = new ColorDrawable(Color.RED);
    }

    @SuppressLint("DrawAllocation")
    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        colorDrawable.setBounds(new Rect(100, 100, getWidth(), getHeight()));
//        colorDrawable.setBounds(100,100,getWidth(),getHeight());
        colorDrawable.draw(canvas);
    }
}
